package net.lovesrc.allin.jobs.backup;

import com.alibaba.fastjson.JSONObject;
import net.lovesrc.allin.biz.DogDog.DogLoginSignService;
import net.lovesrc.allin.biz.DogDog.DogQueue;
import net.lovesrc.allin.biz.gogohome.HomeAccountQueue;
import net.lovesrc.allin.jobs.base.BaseJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicBoolean;

@Component
@Profile("2021")
public class DogDogLoginSinJob extends BaseJob {
    public AtomicBoolean flag = new AtomicBoolean(true);
    public String inviteCode = "H137186";

    @Autowired
    DogLoginSignService dogLoginSign;

    @Override
    public void runOnce() throws Exception {
        try {
            JSONObject take = DogQueue.queue.take();
            dogLoginSign.sign(take);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
    @Override
    public boolean runFlag() {
        return flag.get();
    }
}
